import http from '../httpRequest'

const friendApi = {
  // 获得基本信息
  getFriendList: () => {
    return http({
      url: '/friend/list',
      method: 'GET',
      custom: {
        showLoading: false,
        auth: true,
      },
    });
  },
  // 搜索好友
  findFriend: (data) => {
    return http({
      url: '/friend/search',
      method: 'POST',
	  data,
      custom: {
        showSuccess: true,
        auth: true,
      },
    });
  },
  // 获取单个朋友
  getFriendInfo: (data) => {
    return http({
      url: '/friend/get',
      method: 'POST',
	  data,
      custom: {
        showSuccess: true,
        auth: true,
      },
    });
  },
  // 获取pages朋友列表
  getFriendPage: (data) => {
    return http({
      url: '/friend/page',
      method: 'GET',
      data,
      custom: {
        showSuccess: true,
        auth: true,
      },
    });
  },
  getFriendsPage: (data) => {
    return http({
      url: '/friend/fpage',
      method: 'GET',
      data,
      custom: {
        showSuccess: true,
        auth: true,
      },
    });
  },
  updateFriend:(data)=>{
	return http({
	   url: '/friend/update',
	   method: 'PUT',
	   data,
	   custom: {
	     showSuccess: true,
	     auth: true,
	   },
	});  
  },
  deFriend:(data)=>{
	  // friendId=
	return http({
	   url: '/friend/delete/'+data,
	   method: 'DELETE',
	   custom: {
	     showSuccess: true,
	     auth: true,
	   },
	});
  },
  // 修改设置
  updateSetting:(data)=>{
	return http({
	   url: '/friend/setting',
	   method: 'POST',
	   data,
	   custom: {
	     showSuccess: true,
	     auth: true,
	   },
	}); 
  },
  isAdd:(friendId,groupId)=>{
  	return http({
  	   url: '/friend/isAdd?friendId='+friendId+'&groupId='+groupId,
  	   method: 'GET',
  	   custom: {
  	     showSuccess: true,
  	     auth: true,
  	   },
  	});
  },
  // 获取未读申请消息数量
  getUnreadApplyCount: () => {
    return http({
      url: '/friend/apply/unread/count',
      method: 'GET',
      custom: { 
        showSuccess: true,
        auth: true,
      },
    });
  }
};

export default friendApi;
